function mnrelextrato() {
	$('#content').load("html/mantercontasbancarias.html #pnlRelExtrato", function() { 
		$('#dt_ini').mask('99/99/9999');
		$('#dt_fim').mask('99/99/9999');

    	$('#Edit-ct_nome').autocomplete({
    		source: function (request, response) {
    			params = [{
    							nome: "action",
    							valor: "conta.consultarNome"
    						},
    						{
    							nome: "nome",
    							valor: request.term
    						}];

    			exec(params, 
    					function(dados) {
    						if (dados.Records) {
        						response($.map(dados.Records, function (item) {
        							return [{label: item.nome + " - " + item.saldo,
        									value: item.nome,
        									record: item}];
        							}
        						));
    						}
    					});
    		},
    		select: function (event, ui) {
    			$('#Edit-ct_id').val(ui.item.record.id);
    		}
    	});

    	$("#pnlRelParams").dialog({
		    modal: true,
		    buttons: {
		        Ok: function() {
		        	var dt_ini = $('#dt_ini').val();
		        	var dt_fim = $('#dt_fim').val();
		        	
		        	sendForm('#frmRelParams', function(data) {
		        		var x = open("html/relextrato.html", "Extrato de Conta Bancária", "top=20, left=10, width=1100, height=600");
		        		x.focus;
		        		x.onload = function() {
				        	var lblData = x.document.getElementById('lblPrintDate');
		        			var dthr = new Date().toLocaleString().split(" ");
		        			$(lblData).text(dthr[0] + " às " + dthr[1] + " ");
		        			
		        			var tbBody = x.document.getElementById('tbBody');
		        			var tbFoot = x.document.getElementById('tbFoot');
		        			var detail = x.document.getElementById('trDetail');
		        			var tbRelHead = x.document.getElementById('tbRelHead');
		        			var tr = null;
		        			var sld = "";
		        			
		        			$(data.Records).each(function(index, mvto) {
		        				if (index == 0) {
		        					$(tbRelHead).find("#lblConta").text(mvto.conta_nome);
		        					$(tbRelHead).find("#lblBanco").text(mvto.conta_banco);
		        					$(tbRelHead).find("#lblNumConta").text(mvto.conta_numero);
		        					$(tbRelHead).find("#lblAgencia").text(mvto.conta_agencia);
		        					$(tbFoot).find("#pSaldoAnt").html(mvto.saldo_ant);
		        				}
		        				sld = mvto.saldo_atual;
		        				
		        				tr = $(detail).clone();
		        				$(tr).find('#tdData').html(mvto.data);
		        				$(tr).find('#tdHistorico').html(mvto.historico);
		        				$(tr).find('#tdVr').html(mvto.vr_movimento);
		        				$(tr).find('#tdVr').removeClass("txtCenter");
		        				$(tr).find('#tdVr').addClass("txtRight");
		        				$(tr).find('#tdDc').html(mvto.dc);
			        			$(tbBody).append(tr);
		        			});
		        			
        					$(tbFoot).find("#lblDtIni").text(dt_ini);
        					$(tbFoot).find("#lblDtFim").text(dt_fim);
        					$(tbFoot).find("#pSaldoAtu").html(sld);
        					
		        			$(x.document.getElementById('btnPrint')).click(function() {
		        				$(this).hide();
		        				x.print();
		        				$(this).show();
		        			});
		        		};
		        	});
		            $(this).dialog("close");
		        },
		        Cancelar: function() {
		            $(this).dialog("close");
		        }
		    },
		    close: function() {
	            $(this).remove();
		    }
		});
	});
}